package programer.interviewer;

import java.util.HashSet;
import java.util.Set;

public class Question4 {
    public boolean canPermutePalindrome(String s) {
        if (s  == null || "".equals(s))
            return false;

        char[] charArr = s.toCharArray();
        Set<Character> set = new HashSet<>();
        for(char c: charArr) {
            if (set.contains(c)) {
                set.remove(c);
            } else {
                set.add(c);
            }
        }

        return set.size() <= 1;
    }


    public static void main(String[] args) {
        System.out.println(new Question4().canPermutePalindrome("Mr John Smith"));
    }
}
